css node declaration: Allow both name and type to be set
authorMatthias Clasen <mclasen@redhat.com>
Fri, 23 Oct 2015 00:58:52 +0000 (20:58 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 23 Oct 2015 00:58:52 +0000 (20:58 -0400)
The widget path machinery assumes that we always have types,
and without this change, it will start spewing warnings when
we start to introduce node names.

gtk/gtkcssnodedeclaration.c

index 6d861fb448a849fe272319ba9befd1a47b8a32a7..1c5187b4b6d1bd7f67858845566ceead10ff2fbf 100644 (file)
@@ -170,12 +170,10 @@ gboolean
 gtk_css_node_declaration_set_type (GtkCssNodeDeclaration **decl,
                                    GType                   type)
 {
-  if ((*decl)->type == type &&
-      (*decl)->name == NULL)
+  if ((*decl)->type == type)
     return FALSE;
 
   gtk_css_node_declaration_make_writable (decl);
-  (*decl)->name = NULL;
   (*decl)->type = type;
 
   return TRUE;
@@ -191,12 +189,10 @@ gboolean
 gtk_css_node_declaration_set_name (GtkCssNodeDeclaration   **decl,
                                    /*interned*/ const char  *name)
 {
-  if ((*decl)->type == 0 &&
-      (*decl)->name == name)
+  if ((*decl)->name == name)
     return FALSE;
 
   gtk_css_node_declaration_make_writable (decl);
-  (*decl)->type = 0;
   (*decl)->name = name;
 
   return TRUE;